//
//  ProgressView.m
//  04-06-下载进度Demo
//
//  Created by student on 16/4/6.
//  Copyright © 2016年 niit. All rights reserved.
//

#import "ProgressView.h"

@implementation ProgressView
-(void)setProgress:(float)progress
{
    _progress = progress;
    
    [self setNeedsDisplay];
}
-(void)drawRect:(CGRect)rect
{
    CGPoint center=CGPointMake(rect.size.width/2, rect.size.height/2);
    
    CGFloat radius = rect.size.width/2;
    
    CGFloat startAngle= - M_PI_2;
    CGFloat endAngle = - M_PI_2 + self.progress * M_PI * 2;
    UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:center radius:radius startAngle:startAngle endAngle:endAngle clockwise:YES];
    [path closePath];
    [[UIColor greenColor] setFill];
    [path fill];
    
}
@end
